--region *.lua
--Date
--此文件由[BabeLua]插件自动生成

-- BOSS参与奖励面板
PopUpRewardDlg = Dialog:DeriveClass("PopUpRewardDlg", "PopUpRewardDlg.prefab", 99, {
    _TitleLabel;
    _DescriptLabel;
    _ObjList;
    _Param;

    _Instance;

    
    _CloseTimer;
});

-- BOSS参与奖励面板初始化
function PopUpRewardDlg:OnInit(data)
    self._Param = data[1];
    
    self._TitleLabel = self:GetYLabel("TitleLabel");
    self._TitleLabel.text = self._Param.titleText;

    self._DescriptLabel = self:GetYLabel("DescriptionLabel");
    self._DescriptLabel.text = RichTextUtil.RichText2Html(self._Param.descText);

    self._ObjList = self:GetYObjList("rewardObj");
    local size = table.len(self._Param.rewardVec);
    if self._Param.rewardVec ~= nil then 
        self._ObjList:SetData(self._Param.rewardVec, size, self._Param.objListFunc);
    end 

    local btn = self:GetYButton("ConfirmButton");
    btn:SetClickHandler(self, self.HandleConfirmButtonClick);

    local ytouchableImage = self:GetWindow().Root:GetComponent(UI.YTouchableImage);
    ytouchableImage:SetClickHandler(self, self.HandleYtouchableImageClick);

    if self._Param.closeTime ~= nil and  self._Param.closeTime ~= 0 then
        self._CloseTimer = self:AddTimer(PopUpRewardDlg.ClosePopUpDlg, self._Param.closeTime, 1);
    end
end


function PopUpRewardDlg.PopUp(param)
    if PopUpRewardDlg._Instance ~= nil then 
        DlgMgr:CloseDlg(PopUpRewardDlg);
    end 
    PopUpRewardDlg._Instance = DlgMgr:FetchDlg(PopUpRewardDlg,{param});
    return PopUpRewardDlg._Instance;
end

function PopUpRewardDlg:ClosePopUpDlg()
    if self._Param.closeHandle ~= nil then 
         self._Param.closeHandle(self._Param.closeHandlerCaller);
    end 
    self:Close();
end 

-- 响应确定按钮
function PopUpRewardDlg:HandleConfirmButtonClick()
    self:Close();
end

-- 响应空白确定
function PopUpRewardDlg:HandleYtouchableImageClick()
    self:Close();
end

PopUpRewardParam = {
    titleText;    --标题
    descText;     --描述文字
    rewardVec;     
    objListFunc;
    sceneChangeClose = false; --切换场景关闭弹窗 默认false 不关闭
    closeTime = 0;
    closeHandlerCaller;
    closeHandle;
}

--endregion
